package com.kk.state;

/**
 * @author o_o
 * @date 2022-06-21
 */
public class DispenseRaffle extends State {
    RaffleActivity activity;

    public DispenseRaffle(RaffleActivity activity) {
        this.activity = activity;
    }


    @Override
    public void deductMoney() {
        System.out.println("不扣积分");
        activity.setState(activity.getCanRaffleState());
    }

    @Override
    public boolean raffle() {
        System.out.println("不能抽奖");
        return false;
    }

    @Override
    public void dispensePrize() {
        if (activity.getCount() > 1) {
            System.out.println("恭喜中奖");
            activity.setState(activity.getNoRaffleState());
            return;
        }
        System.out.println("恭喜中奖");
        System.out.println("恭喜您，是最后一位幸运儿");
        System.out.println("奖品已发放完、抽奖结束。");
        System.exit(0);
    }
}
